package com.jr.controller;


import com.jr.entity.Enterprise;
import com.jr.entity.Job;
import com.jr.service.JobService;
import com.jr.util.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;


/**
 * 工作表
 *
 * @author Snoopy
 * @since 1.0.0 2022-12-31
 */
@RestController
@SuppressWarnings("all")
public class JobController {
    @Autowired
    private JobService jobService;

    /**
     * @description: 通过首页进入工作界面
     * @author: 李泽涛
     * @date: 2023/1/6 14:59
     * @param: [jid]
     * @return: org.springframework.web.servlet.ModelAndView
     **/
    @GetMapping(value = "getjobandenterprise",produces = "application/json;charset=utf-8")
    public ModelAndView selectEnterprise(int jid,String jobuserstatus){
        ModelAndView modelAndView=new ModelAndView();
        Job job=jobService.selectJobEnterprise(jid);
        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        job.setJrefreshdatestr(sdf.format(job.getJrefreshdate()));
        job.setJobuserstatus(jobuserstatus);
        modelAndView.addObject("job",job);
        modelAndView.setViewName("job_info.jsp");
        return modelAndView;
    }

    /**
     * @description: 首页展示工作信息
     * @author: 金宏飞
     * @date: 2023/1/3 18:54
     * @param:
     * @return:
     **/
    @RequestMapping(value = "getJobsEnterprise",produces = "application/json;charset=utf-8")
    @ResponseBody
    public List selectEnterpriseJobs() {
        return  jobService.selectJobsEnterprise();
    }


}